export function maxArea (height: number[]): number {
    let area = 0;
    let left = 0;
    let right = height.length - 1;

    while (left < right) {
        let h = Math.min(height[left], height[right]);
        let tempArea = h * (right - left);
        if (tempArea > area) area = tempArea;

        if (height[left] > height[right]) {
            right--;
        } else {
            left++;
        }
    }

    return area;
}